package com.mqtt.demo.mqtt;

import org.springframework.integration.annotation.MessagingGateway;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Component;

/**
 * @ClassName MqttGateway
 * @Description MqttGateway
 * @Author lcy
 * @Date 9:43 2019/7/24
 * @Version 1.0
 **/
@Component
@MessagingGateway(defaultRequestChannel = "mqttOutboundChannel")
public interface MqttGateway {
    /**
     * send message by define topic
     * @param message
     */
    void sendToMqtt(String message);

    /**
     * send message with topic
     * @param topic
     * @param message
     */
    void sendToMqtt(@Header("mqtt_topic") String topic, String message);

    /**
     * send topic with topic and qos
     * @param topic
     * @param qos
     * @param message
     */
    void sendToMqtt(@Header("mqtt_topic") String topic, @Header("mqtt_qos") int qos, String message);
}